package edu.ufop.vaadin.helloworld.dao;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.sql.Connection;
import edu.ufop.vaading.helloworld.model.User;
import edu.ufop.vaading.helloworld.ConnectionFactory;


public class LoginDao {
	private Connection connection;
	
	public LoginDao(){
		this.connection = new ConnectionFactory().getConnection();
	}
	
	public boolean insertUser(User usr){
		String sql = "insert into usuarios "+ "(email,password)" + "values(?,?)";
		
		try{
			PreparedStatement stmt = connection.prepareStatement(sql);
			
			stmt.setString(1, usr.getEmail());
			stmt.setString(2, usr.getPassword());
			stmt.execute();
			stmt.close();
			
		}catch(SQLException e){
			throw new RuntimeException(e);		
		}
		
		
	}
	
	public boolean updateUser(User usr); 
	
	public boolean remove (User usr); 
	
	public List<User> listUsers();

}
